package lily.phs.object;

import lily.phs.database.Constants;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.util.Log;


public class OneChild implements Constants{
	
	private Context myContext;
	public int onch_profileid=-1;
	public int onch_state=-1;
	public String onch_date="";
	public float onch_weig_value=-1;
	public int onch_weig_choi=-1;
	public float onch_heig_value=-1;
	public int onch_heig_choi=-1;
	public float onch_head_size=-1;
	public int onch_complexion=-1;
	public int onch_skin=-1;
	public int onch_bregma_choi=-1;
	public float onch_bregma_left=-1;
	public float onch_bregma_right=-1;
	public int onch_neck_mass=-1;
	public int onch_eye_appearance=-1;
	public int onch_ear_appearance=-1;
	public int onch_hearing=-1;
	public int onch_oral=-1;
	public int onch_card=-1;
	public int onch_abdomen=-1;
	public int onch_umbilical=-1;
	public int onch_legs=-1;
	public String onch_stoop_symp="";
	public String onch_stoop_sign="";
	public int onch_anus=-1;
	public float onch_sanguine=-1;
	public float onch_activity=-1;
	public float  onch_vd=-1;
	public int onch_deve_asse=-1;
	public int onch_deases=-1;
	public String onch_other="";
	public int onch_refe_choi=-1;
	public String onch_refe_reasion="";
	public String onch_refe_inst="";
	public String onch_guide="";
	public String onch_next_date="";
	public String onch_doctor="";
	
	public OneChild(Context context){
		this.myContext=context;
	}
	
	public int getOnch_profileid() {
		return onch_profileid;
	}
	public void setOnch_profileid(int onchProfileid) {
		onch_profileid = onchProfileid;
	}
	
	public int getOnch_state() {
		return onch_state;
	}

	public void setOnch_state(int onchState) {
		onch_state = onchState;
	}

	public String getOnch_date() {
		return onch_date;
	}
	public void setOnch_date(String onchDate) {
		onch_date = onchDate;
	}
	public float getOnch_weig_value() {
		return onch_weig_value;
	}
	public void setOnch_weig_value(float onchWeigValue) {
		onch_weig_value = onchWeigValue;
	}
	public int getOnch_weig_choi() {
		return onch_weig_choi;
	}
	public void setOnch_weig_choi(int onchWeigChoi) {
		onch_weig_choi = onchWeigChoi;
	}
	public float getOnch_heig_value() {
		return onch_heig_value;
	}
	public void setOnch_heig_value(float onchHeigValue) {
		onch_heig_value = onchHeigValue;
	}
	public int getOnch_heig_choi() {
		return onch_heig_choi;
	}
	public void setOnch_heig_choi(int onchHeigChoi) {
		onch_heig_choi = onchHeigChoi;
	}
	public float getOnch_head_size() {
		return onch_head_size;
	}
	public void setOnch_head_size(float onchHeadSize) {
		onch_head_size = onchHeadSize;
	}
	public int getOnch_complexion() {
		return onch_complexion;
	}
	public void setOnch_complexion(int onchComplexion) {
		onch_complexion = onchComplexion;
	}
	public int getOnch_skin() {
		return onch_skin;
	}
	public void setOnch_skin(int onchSkin) {
		onch_skin = onchSkin;
	}
	public int getOnch_bregma_choi() {
		return onch_bregma_choi;
	}
	public void setOnch_bregma_choi(int onchBregmaChoi) {
		onch_bregma_choi = onchBregmaChoi;
	}
	public float getOnch_bregma_left() {
		return onch_bregma_left;
	}
	public void setOnch_bregma_left(float onchBregmaLeft) {
		onch_bregma_left = onchBregmaLeft;
	}
	public float getOnch_bregma_right() {
		return onch_bregma_right;
	}
	public void setOnch_bregma_right(float onchBregmaRight) {
		onch_bregma_right = onchBregmaRight;
	}
	public int getOnch_neck_mass() {
		return onch_neck_mass;
	}
	public void setOnch_neck_mass(int onchNeckMass) {
		onch_neck_mass = onchNeckMass;
	}
	public int getOnch_eye_appearance() {
		return onch_eye_appearance;
	}
	public void setOnch_eye_appearance(int onchEyeAppearance) {
		onch_eye_appearance = onchEyeAppearance;
	}
	public int getOnch_ear_appearance() {
		return onch_ear_appearance;
	}
	public void setOnch_ear_appearance(int onchEarAppearance) {
		onch_ear_appearance = onchEarAppearance;
	}
	public int getOnch_hearing() {
		return onch_hearing;
	}
	public void setOnch_hearing(int onchHearing) {
		onch_hearing = onchHearing;
	}
	public int getOnch_oral() {
		return onch_oral;
	}
	public void setOnch_oral(int onchOral) {
		onch_oral = onchOral;
	}
	public int getOnch_card() {
		return onch_card;
	}
	public void setOnch_card(int onchCard) {
		onch_card = onchCard;
	}
	public int getOnch_abdomen() {
		return onch_abdomen;
	}
	public void setOnch_abdomen(int onchAbdomen) {
		onch_abdomen = onchAbdomen;
	}
	public int getOnch_umbilical() {
		return onch_umbilical;
	}
	public void setOnch_umbilical(int onchUmbilical) {
		onch_umbilical = onchUmbilical;
	}
	public int getOnch_legs() {
		return onch_legs;
	}
	public void setOnch_legs(int onchLegs) {
		onch_legs = onchLegs;
	}
	public String getOnch_stoop_symp() {
		return onch_stoop_symp;
	}
	public void setOnch_stoop_symp(String onchStoopSymp) {
		onch_stoop_symp = onchStoopSymp;
	}
	public String getOnch_stoop_sign() {
		return onch_stoop_sign;
	}
	public void setOnch_stoop_sign(String onchStoopSign) {
		onch_stoop_sign = onchStoopSign;
	}
	public int getOnch_anus() {
		return onch_anus;
	}
	public void setOnch_anus(int onchAnus) {
		onch_anus = onchAnus;
	}
	public float getOnch_sanguine() {
		return onch_sanguine;
	}
	public void setOnch_sanguine(float onchSanguine) {
		onch_sanguine = onchSanguine;
	}
	public float getOnch_activity() {
		return onch_activity;
	}
	public void setOnch_activity(float onchActivity) {
		onch_activity = onchActivity;
	}
	public float getOnch_vd() {
		return onch_vd;
	}
	public void setOnch_vd(float onchVd) {
		onch_vd = onchVd;
	}
	public int getOnch_deve_asse() {
		return onch_deve_asse;
	}
	public void setOnch_deve_asse(int onchDeveAsse) {
		onch_deve_asse = onchDeveAsse;
	}
	public int getOnch_deases() {
		return onch_deases;
	}
	public void setOnch_deases(int onchDeases) {
		onch_deases = onchDeases;
	}
	public String getOnch_other() {
		return onch_other;
	}
	public void setOnch_other(String onchOther) {
		onch_other = onchOther;
	}
	public int getOnch_refe_choi() {
		return onch_refe_choi;
	}
	public void setOnch_refe_choi(int onchRefeChoi) {
		onch_refe_choi = onchRefeChoi;
	}
	public String getOnch_refe_reasion() {
		return onch_refe_reasion;
	}
	public void setOnch_refe_reasion(String onchRefeReasion) {
		onch_refe_reasion = onchRefeReasion;
	}
	public String getOnch_refe_inst() {
		return onch_refe_inst;
	}
	public void setOnch_refe_inst(String onchRefeInst) {
		onch_refe_inst = onchRefeInst;
	}
	public String getOnch_guide() {
		return onch_guide;
	}
	public void setOnch_guide(String onchGuide) {
		onch_guide = onchGuide;
	}
	public String getOnch_next_date() {
		return onch_next_date;
	}
	public void setOnch_next_date(String onchNextDate) {
		onch_next_date = onchNextDate;
	}
	public String getOnch_doctor() {
		return onch_doctor;
	}
	public void setOnch_doctor(String onchDoctor) {
		onch_doctor = onchDoctor;
	}
	
	public void insertOneChild(){
		ContentValues value;
		value = new ContentValues();
		value.put(ONCH_PROFILEID , this.onch_profileid);
		value.put(ONCH_STATE, this.onch_state);
		value.put(ONCH_DATE  , this.onch_date);
		value.put(ONCH_WEIG_VALUE , this.onch_weig_value);
		value.put(ONCH_WEIG_CHOI , this.onch_weig_choi);
		value.put(ONCH_HEIG_VALUE  , this.onch_heig_value);
		value.put(ONCH_HEIG_CHOI  , this.onch_heig_choi);
		value.put(ONCH_HEAD_SIZE  , this.onch_head_size);
		value.put(ONCH_COMPLEXION  , this.onch_complexion);
		value.put(ONCH_SKIN  , this.onch_skin);
		value.put(ONCH_BREGMA_CHOI  , this.onch_bregma_choi);
		value.put(ONCH_BREGMA_LEFT  , this.onch_bregma_left);
		value.put(ONCH_BREGMA_RIGHT  , this.onch_bregma_right);
		value.put(ONCH_NECK_MASS  , this.onch_neck_mass);
		value.put(ONCH_EYE_APPEARANCE  , this.onch_eye_appearance);
		value.put(ONCH_EAR_APPEARANCE  , this.onch_ear_appearance);
		value.put(ONCH_HEARING  , this.onch_hearing);
		value.put(ONCH_ORAL  , this.onch_oral);
		value.put(ONCH_CARD  , this.onch_card);
		value.put(ONCH_ABDOMEN  , this.onch_abdomen);
		value.put(ONCH_UMBILICAL  , this.onch_umbilical);
		value.put(ONCH_LEGS  , this.onch_legs);
		value.put(ONCH_STOOP_SYMP  , this.onch_stoop_symp);
		value.put(ONCH_STOOP_SIGN  , this.onch_stoop_sign);
		value.put(ONCH_ANUS  , this.onch_anus);
		value.put(ONCH_SANGUINE  , this.onch_sanguine);
		value.put(ONCH_ACTIVITY  , this.onch_activity);
		value.put(ONCH_VD  , this.onch_vd);
		value.put(ONCH_DEVE_ASSE  , this.onch_deve_asse);
		value.put(ONCH_DEASES  , this.onch_deases);
		value.put(ONCH_OTHER  , this.onch_other);
		value.put(ONCH_REFE_CHOI  , this.onch_refe_choi);
		value.put(ONCH_REFE_REASION  , this.onch_refe_reasion);
		value.put(ONCH_REFE_INST  , this.onch_refe_inst);
		value.put(ONCH_GUIDE  , this.onch_guide);
		value.put(ONCH_NEXT_DATE  , this.onch_next_date);
		value.put(ONCH_DOCTOR , this.onch_doctor);
		myContext.getContentResolver().insert(CONTENT_URI_TB13, value);
	}
	
	public void selectOneChild(int pro,int state){
		Cursor cursor = myContext.getContentResolver().query(CONTENT_URI_TB13, null,
				ONCH_PROFILEID + "=" + pro + " AND "+ONCH_STATE+"="+state, null, null);
		Log.e("One", "count="+cursor.getCount());
		/*cursor = myContext.getContentResolver().query(CONTENT_URI_TB13, null,
				ONCH_PROFILEID + "=" + pro , null, null);
		Log.e("One", "count="+cursor.getCount());*/
		while(cursor.moveToNext()){
			this.onch_profileid=cursor.getInt(cursor.getColumnIndex(ONCH_PROFILEID ));
			this.onch_state=cursor.getInt(cursor.getColumnIndex(ONCH_STATE ));
			this.onch_date=cursor.getString(cursor.getColumnIndex(ONCH_DATE  ));
			this.onch_weig_value=cursor.getFloat(cursor.getColumnIndex(ONCH_WEIG_VALUE  ));
			this.onch_weig_choi=cursor.getInt(cursor.getColumnIndex(ONCH_WEIG_CHOI  ));
			this.onch_heig_value=cursor.getFloat(cursor.getColumnIndex(ONCH_HEIG_VALUE  ));
			this.onch_heig_choi=cursor.getInt(cursor.getColumnIndex(ONCH_HEIG_CHOI  ));
			this.onch_head_size=cursor.getFloat(cursor.getColumnIndex(ONCH_HEAD_SIZE  ));
			this.onch_complexion=cursor.getInt(cursor.getColumnIndex(ONCH_COMPLEXION  ));
			this.onch_skin=cursor.getInt(cursor.getColumnIndex(ONCH_SKIN  ));
			this.onch_bregma_choi=cursor.getInt(cursor.getColumnIndex(ONCH_BREGMA_CHOI  ));
			this.onch_bregma_left=cursor.getFloat(cursor.getColumnIndex(ONCH_BREGMA_LEFT  ));
			this.onch_bregma_right=cursor.getFloat(cursor.getColumnIndex(ONCH_BREGMA_RIGHT  ));
			this.onch_neck_mass=cursor.getInt(cursor.getColumnIndex(ONCH_NECK_MASS  ));
			this.onch_eye_appearance=cursor.getInt(cursor.getColumnIndex(ONCH_EYE_APPEARANCE  ));
			this.onch_ear_appearance=cursor.getInt(cursor.getColumnIndex(ONCH_EAR_APPEARANCE  ));
			this.onch_hearing=cursor.getInt(cursor.getColumnIndex(ONCH_HEARING  ));
			this.onch_oral=cursor.getInt(cursor.getColumnIndex(ONCH_ORAL  ));
			this.onch_card=cursor.getInt(cursor.getColumnIndex(ONCH_CARD  ));
			this.onch_abdomen=cursor.getInt(cursor.getColumnIndex(ONCH_ABDOMEN  ));
			this.onch_umbilical=cursor.getInt(cursor.getColumnIndex(ONCH_UMBILICAL  ));
			this.onch_legs=cursor.getInt(cursor.getColumnIndex(ONCH_LEGS  ));
			this.onch_stoop_symp=cursor.getString(cursor.getColumnIndex(ONCH_STOOP_SYMP  ));
			this.onch_stoop_sign=cursor.getString(cursor.getColumnIndex(ONCH_STOOP_SIGN  ));
			this.onch_anus=cursor.getInt(cursor.getColumnIndex(ONCH_ANUS  ));
			this.onch_sanguine=cursor.getFloat(cursor.getColumnIndex(ONCH_SANGUINE  ));
			this.onch_activity=cursor.getFloat(cursor.getColumnIndex(ONCH_ACTIVITY  ));
			this.onch_vd=cursor.getFloat(cursor.getColumnIndex(ONCH_VD  ));
			this.onch_deve_asse=cursor.getInt(cursor.getColumnIndex(ONCH_DEVE_ASSE  ));
			this.onch_deases=cursor.getInt(cursor.getColumnIndex(ONCH_DEASES  ));
			this.onch_other=cursor.getString(cursor.getColumnIndex(ONCH_OTHER  ));
			this.onch_refe_choi=cursor.getInt(cursor.getColumnIndex(ONCH_REFE_CHOI  ));
			this.onch_refe_reasion=cursor.getString(cursor.getColumnIndex(ONCH_REFE_REASION  ));
			this.onch_refe_inst=cursor.getString(cursor.getColumnIndex(ONCH_REFE_INST  ));
			this.onch_guide=cursor.getString(cursor.getColumnIndex(ONCH_GUIDE  ));
			this.onch_next_date=cursor.getString(cursor.getColumnIndex(ONCH_NEXT_DATE  ));
			this.onch_doctor=cursor.getString(cursor.getColumnIndex(ONCH_DOCTOR  ));
		}
		cursor.close();
	}
	
	public void updateOneChild(int pro,int state){
		ContentValues value;
		value = new ContentValues();
		value.put(ONCH_DATE  , this.onch_date);
		value.put(ONCH_WEIG_VALUE , this.onch_weig_value);
		value.put(ONCH_WEIG_CHOI , this.onch_weig_choi);
		value.put(ONCH_HEIG_VALUE  , this.onch_heig_value);
		value.put(ONCH_HEIG_CHOI  , this.onch_heig_choi);
		value.put(ONCH_HEAD_SIZE  , this.onch_head_size);
		value.put(ONCH_COMPLEXION  , this.onch_complexion);
		value.put(ONCH_SKIN  , this.onch_skin);
		value.put(ONCH_BREGMA_CHOI  , this.onch_bregma_choi);
		value.put(ONCH_BREGMA_LEFT  , this.onch_bregma_left);
		value.put(ONCH_BREGMA_RIGHT  , this.onch_bregma_right);
		value.put(ONCH_NECK_MASS  , this.onch_neck_mass);
		value.put(ONCH_EYE_APPEARANCE  , this.onch_eye_appearance);
		value.put(ONCH_EAR_APPEARANCE  , this.onch_ear_appearance);
		value.put(ONCH_HEARING  , this.onch_hearing);
		value.put(ONCH_ORAL  , this.onch_oral);
		value.put(ONCH_CARD  , this.onch_card);
		value.put(ONCH_ABDOMEN  , this.onch_abdomen);
		value.put(ONCH_UMBILICAL  , this.onch_umbilical);
		value.put(ONCH_LEGS  , this.onch_legs);
		value.put(ONCH_STOOP_SYMP  , this.onch_stoop_symp);
		value.put(ONCH_STOOP_SIGN  , this.onch_stoop_sign);
		value.put(ONCH_ANUS  , this.onch_anus);
		value.put(ONCH_SANGUINE  , this.onch_sanguine);
		value.put(ONCH_ACTIVITY  , this.onch_activity);
		value.put(ONCH_VD  , this.onch_vd);
		value.put(ONCH_DEVE_ASSE  , this.onch_deve_asse);
		value.put(ONCH_DEASES  , this.onch_deases);
		value.put(ONCH_OTHER  , this.onch_other);
		value.put(ONCH_REFE_CHOI  , this.onch_refe_choi);
		value.put(ONCH_REFE_REASION  , this.onch_refe_reasion);
		value.put(ONCH_REFE_INST  , this.onch_refe_inst);
		value.put(ONCH_GUIDE  , this.onch_guide);
		value.put(ONCH_NEXT_DATE  , this.onch_next_date);
		value.put(ONCH_DOCTOR , this.onch_doctor);
		myContext.getContentResolver().update(CONTENT_URI_TB13, value, 
				ONCH_PROFILEID + "=" + pro + " AND "+ONCH_STATE+"="+state, null);
	}
	
	public void deleteOneChild(int pro){
		myContext.getContentResolver().delete(CONTENT_URI_TB13,
				ONCH_PROFILEID + "=" + pro + "", null);
	}

}
